package com.liyy.platform.other.mytest;

public class TestThread1 {
	public static void main(String[] args) {
		Thread t1 =new Thread(new Runner1());
		Thread t2 =new Thread(new Runner2());
		t1.setPriority(9);
		t1.start();//2个线程交替执行（并行执行）
		t2.start();//2个线程交替执行（并行执行）
	}
}

class Runner1 implements Runnable{
//class Runner1 extends Thread{ 2种创建线程的方法，优先选择实现接口，控制较为方便
	public void run() {
		for (int i=0;i<1000;i++){
			System.out.println("r1:"+i);
		}
	}
	
}

class Runner2 implements Runnable{
	//class Runner1 extends Thread{ 2种创建线程的方法，优先选择实现接口，控制较为方便
		public void run() {
			for (int i=0;i<1000;i++){
				System.out.println("r2:"+i);
			}
		}
		
	}
